package com.adu.demo.controller;
import java.util.List;
import com.adu.demo.domain.BookTag;
import com.adu.demo.service.Impl.BookTagService;
import com.adu.demo.util.JsonResult;
import com.adu.demo.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
                                            // 测试
@RestController
@RequestMapping("/BookTag")
public class BookTagController extends BaseController {
    @Autowired
    private BookTagService booktagService;

    @GetMapping("/getList")
    public Result getList(@RequestBody BookTag booktag){
        startPage();
        List<BookTag> booktagList=booktagService.getList(booktag);
        return JsonResult.OK(200,"success",booktagList);
    }

    @GetMapping("/getById")
    public Result getById(Long id){
        BookTag booktag=booktagService.getById(id);
        return JsonResult.OK(200,"success",booktag);
    }
    @PostMapping("/save")
    public Result save(@RequestBody BookTag booktag){
        booktagService.save(booktag);
        return JsonResult.OK(200,"success");
    }
    @DeleteMapping("/removeBatch")
    public Result remove(@PathVariable Long[] ids){
        booktagService.deleteByIds(ids);
        return JsonResult.OK(200,"success");
    }
    @DeleteMapping("/remove")
    public Result remove(@PathVariable Long id){
        booktagService.deleteById(id);
        return JsonResult.OK(200,"success");
    }
    @GetMapping("/update")
    public Result update(@RequestBody BookTag booktag){
        booktagService.update(booktag);
        return JsonResult.OK(200,"success");
    }
}